var url = require("url");
var querystring = require("querystring");
var fs = require("fs");
var wechat_cfg = require("../wechat-cfg.json");
var wechat = require('node-wechat')(wechat_cfg.Token);
var evernote_cfg = require('../evernote-cfg.json');
var simpleEvernote = require('../lib/simpleEvernote.js')({
    token: evernote_cfg.production.token,//申请的开发者token，正式环境使用evernote_cfg.production.token,沙盒使用evernote_cfg.develop.token
    sandbox: evernote_cfg.evernoteNotUseSandbox,//是否使用沙盒，正式上线时否
    serviceHost: "app.yinxiang.com" //印象笔记中国使用app.yinxiang.com,evernote使用www.evernote.com
});
var express = require('express');
var router = express.Router();
var path = require('path');
var fetchUrl = require("fetch").fetchUrl;
var cheerio = require('cheerio');
var http = require('http');

function wechat_get(req,res,next){
    //校验是否是微信公众平台发来的请求
    var query = querystring.parse(url.parse(req.url).query);

    if (query.signature && query.timestamp && query.nonce) {
        //检验 token


        wechat.checkSignature(req, res);

    }else {
            next();
        }
}

module.exports = wechat_get;